/*
	File: Game.h
	Author: Zachary Murray
	Purpose: Game class controls the game state machine
*/
#include "ParticleManager.h"
#include "../SGD Wrappers/SGD_Listener.h"
#include "../SGD Wrappers/SGD_Declarations.h"

#include "../SGD Wrappers/SGD_Declarations.h"

//Forward declarations
class IGameState;
class BitmapFont;
class SoundPlayer;

#pragma once
class Game
{
public:
	//Singleton accessors
	static Game* GetInstance();
	static void DeleteInstance();

	//Init, Play, Shutdown
	bool Initialize(int width, int height);
	int Play();
	void Shutdown();

	//Screen dimension accessors
	int GetScreenWidth() const { return screenWidth; }
	int GetScreenHeight() const { return screenHeight; }
	SGD::Point GetCameraPos() { return cameraPos; }
	float GetZoomLevel() { return zoomLevel; }
	float GetPrevZoomLevel() { return prevZoomLevel; }

	//Mutators
	void SetCameraPos(SGD::Point p){ cameraPos = p; }
	void SetZoomLevel(float zoom){ zoomLevel = zoom; }
	void SetPrevZoomLevel(float zoom) { prevZoomLevel = zoom; }

	//Game State Machine
	void ChangeState(IGameState* newState);

	//Font accessor
	BitmapFont* GetFont() const { return font; }
	//fullscreen
	void ChangeWindowed(){ windowed = !windowed; }
	bool GetWindowed(){ return windowed; }
	void ZoomOut(float zoom);
	void ZoomIn(float zoom);

	IGameState* GetCurrentState() const { return currentState; }

private:
	//Singleton Object
	static Game* gameInstance;
	//
	ParticleManager pmanage;

	Game() = default;//default ctor
	~Game() = default;//dtor
	Game(const Game&) = delete;//copy ctor
	Game& operator=(const Game&) = delete; //assignment operator

	//SGD Wrappers
	SGD::AudioManager* audio = nullptr;
	SGD::GraphicsManager* graphics = nullptr;
	SGD::InputManager* input = nullptr;

	SGD::EventManager* events = nullptr;

	//Screen size
	//Particles
	ParticleManager*particles = nullptr;

	//Screen and Camera Dimensions
	SGD::Size worldSize;
	SGD::Point cameraPos;
	int screenWidth = 1;
	int screenHeight = 1;
	int screenHeighthold = 0;
	int screenWidthhold = 0;
	bool windowed = true;
	float zoomLevel = 1.f;
	float prevZoomLevel = 1.f;

	//Bitmap font
	BitmapFont* font = nullptr;

	//SoundPlayer
	SoundPlayer* soundPlayer = nullptr;

	//Game Time
	unsigned long long gameTime = 0;

	//Current Game State
	IGameState* currentState = nullptr;
};

